package hottargui.gui;

import java.awt.event.MouseEvent;

import minidraw.framework.Drawing;
import minidraw.framework.DrawingEditor;
import minidraw.framework.Figure;
import minidraw.framework.Tool;
import hottargui.framework.Game;
import hottargui.view.CardFigure;
import hottargui.view.ToolDecorator;

public class TurnTribeCardToolDecorator extends ToolDecorator {

	public TurnTribeCardToolDecorator(DrawingEditor editor, Game game, Tool decoratedTool) {
		super(editor, game, decoratedTool);
	}

	@Override
	public void mouseDown(MouseEvent e, int x, int y) 
	{
		Drawing model = editor().drawing();
		Figure figureUnderCursor = model.findFigure(x, y);
		
		if (figureUnderCursor instanceof CardFigure) 
		{
			game.turnCard();
		} 
		else 
		{
			decoratee.mouseDown(e, x, y);
		}
	}

}
